package com.project.aaos.controller;

import com.project.aaos.dao.Studentmapper;
import com.project.aaos.pojo.Student;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class HomeController {

    private Logger logger = Logger.getLogger(HomeController.class);
    @Autowired
    private Studentmapper studentmapper;

    @RequestMapping(value = "/hello",produces="text/json;charset=utf-8")
    @ResponseBody
    public String hello(){

        List<Student> list = studentmapper.getObjects();
        for (Student student:list){
            System.out.println(student);
        }
        System.out.println("你好");

        logger.info(list.get(0).toString());
        return list.get(0).toString();
    }

    public static void main(String[] args) {
        System.out.println("你好");
    }
}
